using System.Collections.Generic;
using Schedule;

namespace TaskPluginInterface
{

    /// <summary>
    /// This delegate is used to signify the start of the Execute
    /// </summary>
    /// <param name="sender">A reference to the plug-in the fired the event.</param>
    /// <param name="e">The <see cref="PluginEventArgs"/> event arguments.</param>
    public delegate void OnStart(object sender, PluginEventArgs e);
    /// <summary>
    /// This delegate is used to signify the end of the Execute
    /// </summary>
    /// <param name="sender">A reference to the plug-in the fired the event.</param>
    /// <param name="e">The <see cref="PluginEventArgs"/> event arguments.</param>
    public delegate void OnEnd(object sender, PluginEventArgs e);
    /// <summary>
    /// This is used to notify the progress of the Execute method
    /// </summary>
    /// <param name="sender">A reference to the plug-in the fired the event.</param>
    /// <param name="e">The <see cref="PluginEventArgs"/> event arguments.</param>
    public delegate void OnProcessing(object sender, PluginEventArgs e);
    /// <summary>
    /// This is used to notify of an exception.
    /// </summary>
    /// <param name="sender">A reference to the plug-in the fired the event.</param>
    /// <param name="e">The <see cref="PluginEventArgs"/> event arguments.</param>
    public delegate void OnExceptionOccurred(object sender, PluginEventArgs e);

    /// <summary>
    /// Defines an interface for the plug-in architecture.
    /// </summary>
    /// <remarks><img src="../images/ITaskPlugin.png" /></remarks>
    public interface ITaskPlugin
    {

        #region Properties

        #region Meta Data

        // Meta Data about the plug-in
        /// <summary>
        /// The name of the plug-in.
        /// </summary>
        string Name { get;}
        /// <summary>
        /// The description of the plug-in.
        /// </summary>
        string Description { get;}
        /// <summary>
        /// The extension that this plug-in handles.
        /// </summary>
        string Extension { get;}
        /// <summary>
        /// The description of the extension that this plug-in handles.
        /// </summary>
        string ExtensionDescription { get;}
        /// <summary>
        /// The version of the plug-in.
        /// </summary>
        string Version { get;}
        /// <summary>
        /// The author of the plug-in.
        /// </summary>
        string Author { get;}

        /// <summary>
        /// Returns the schedule for the plug-in.
        /// </summary>
        List<IScheduledItem> Schedule { get;}

        #endregion Meta Data



        #endregion Properties

        #region Methods

        /// <summary>
        /// Executes the plug-in.
        /// </summary>
        /// <returns>A <see cref="ExecuteResult"/></returns>
        ExecuteResult Execute();

        /// <summary>
        /// Cancels the execution of a plug-in
        /// </summary>
        /// <returns>True, if the cancel request was excepted, otherwise false.</returns>
        bool Cancel();

        #endregion Methods

        #region Events

        /// <summary>
        /// This is used to notify the plug-in host about the starting of the Execute Method.
        /// </summary>
        event OnStart EventStart;
        /// <summary>
        /// This is used to notify plug-in host about the ending of the Execute Method.
        /// </summary>
        event OnEnd EventEnd;
        /// <summary>
        /// This is used to notify plug-in host about the processing of the Execute Method.
        /// </summary>
        event OnProcessing EventProcessing;
        /// <summary>
        /// This is used to notify plug-in host about any Exceptions that have occurred.
        /// </summary>
        event OnExceptionOccurred EventExceptionOccurred;

        #endregion Events

    }
}
